<fieldset>

    <legend class="layui-bg-cyan">条件搜索</legend>
    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">真实姓名</label>
            <div class="layui-input-inline">
                <input name="realname" value="{$Think.get.realname|default=''}" placeholder="请输入真实姓名" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">手机号码</label>
            <div class="layui-input-inline">
                <input name="phone" value="{$Think.get.phone|default=''}" placeholder="请输入手机号码" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">学校</label>
            <div class="layui-input-inline">
                <input name="school_id" value="{$Think.get.school_id|default=''}" data-source="{:url('/admin/school/selectpage')}" data-position="fixed" data-field="name" placeholder="学校" class="layui-input selectpage">
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">年级</label>
            <div class="layui-input-inline">
                <input name="grade_id" value="{$Think.get.grade_id|default=''}" data-source="{:url('/admin/school_grade/selectpage')}" data-position="fixed" data-field="name" placeholder="年级" class="layui-input selectpage">
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">班级</label>
            <div class="layui-input-inline">
                <input name="class_id" value="{$Think.get.class_id|default=''}" data-source="{:url('/admin/school_class/selectpage')}" data-position="fixed" data-field="name" placeholder="班级" class="layui-input selectpage">
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
            <button type="button" class="layui-btn layui-btn-primary" id="import"><i class="layui-icon"></i>导入学生EXCEL</button>&nbsp;
            <button type="button" data-import-list class="layui-btn layui-btn-primary"><i class="layui-icon layui-icon-export"></i>下载导入学生模板</button>
            <button type="button" data-modal='{:url("export_student_form")}' class="layui-btn layui-btn-primary"><i class="layui-icon layui-icon-export"></i>导出学生数据</button>&nbsp;
            <!--<button type="button" data-export-list class="layui-btn layui-btn-primary"><i class="layui-icon layui-icon-export"></i> 导 出</button>-->
        </div>
    </form>
    <script>
        window.form.render();
        $('[data-import-list]').on('click', function () {
            console.log('click')
            window.location.href = '{:url("import_student_template",false,false)}?' + $(this).parents('form').serialize()
        });
    </script>

    <script>
        layui.use('upload', function () {
            var upload = layui.upload;

            upload.render({
                elem: '#import'
                , url: '{:url("import_student",false,false)}'
                , accept: 'file'
                , size: 60000 //限制文件大小，单位 KB
                , done: function (res) {
                    if(res.code==1){
                        alert('导入成功，用户信息已更新！')
                    }else if(res.code==0){
                        alert('导入失败，格式有误！')
                    }

                }
            });
        });

    </script>
</fieldset>